True if the point (x, y) is on a One-way square of the room (a square painted One-way in the Room Editor): a platform that stops a body only when it lands on its top. Every other collision call treats a One-way square as open, so something that is not asking walks and falls straight through it.
Sega Genesis: not built yet
On other consoles this differs: see Side by side and How the consoles differ.
tile_one_way(x, y) -> bool| Name | Type |
|---|---|
x | real |
y | real |
bool
Asks whether one spot of the room is on a One-way platform. A One-way square is one you painted with the One-way button in the Room Editor's Collision section. It is a floor that only catches you from above: you can jump up through it, walk through it from the side, and stand on top of it.
x and y are a place in the room, counted from the room's top-left corner. The answer is true when that spot is inside a One-way square. A square with a shape counts only where its shape is solid, so a platform can sit at any height inside its square.
Every other collision call (tile_solid, tile_free, move_slide) treats a One-way square as open air. That is why a thing that does not ask about One-way platforms simply falls through them, and why nothing you wrote before One-way existed changes.
Something is standing on a One-way platform when the spot just under its feet is part of one, and the spot at its feet is not. That second part is what lets a thing that is already inside a platform, because it jumped up through it or walked in from the side, keep going instead of getting stuck on it.
var on_top = tile_one_way(x, box_bottom) && !tile_one_way(x, box_bottom - 1);On a sloped One-way floor (a slope or curve drawn with the class One-way) the same test works at every pixel: the slope's top is a little higher in each column, and tile_one_way(x, box_bottom) is true right where the top is in the column under x. To follow a slope with your own thing, ask the column under the middle of its feet each step and set its feet on the top you find.
tile_ground_y also counts the top of a One-way platform as ground. Player movement does all of this for the player when Stands on one-way platforms is ticked.
A point outside the room, and a room with no One-way square at all, give false.
// a crate that falls until it lands on a floor or on top of a one-way platform
var landed = tile_one_way(x, box_bottom) && !tile_one_way(x, box_bottom - 1);
if (!landed && tile_free(x, y + 1)) {
y += 1;
}A square with a shape is a platform only where its shape is solid, so the top of a One-way platform can be at any height inside its square, not only on the 8 pixel grid. A point outside the room, and a room with no One-way square, give false. Something stands on a One-way platform when the spot just under its feet is one and the spot at its feet is not: tile_one_way(x, box_bottom) and not tile_one_way(x, box_bottom - 1). tile_ground_y counts the top of a One-way platform as ground. tile_free, tile_solid, tile_wall and move_slide never stop at a One-way square. Player movement’s Stands on one-way platforms does the standing, the jumping up through and the dropping through for the player.